﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MathHelper 
{
    /// <summary>
    /// 交换数据
    /// <summary>
    static public void Swap<T>(ref T x, ref T y)
    {
        T temp = x;
        x = y;
        y = temp;
    }

    /// <summary>
    /// 将列表随机（洗牌）
    /// </summary>
    static public void ShuffleList<T>(ref T[] dataList)
    {
        int len = dataList.Length;

        for (int i = len - 1; i >= 1; --i)
        {
            Swap<T>(ref dataList[i], ref dataList[UnityEngine.Random.Range(0, i)]);
        }
    }

}
